package cn.kgc.service.impl;

import cn.kgc.mapper.DisburseMapper;
import cn.kgc.pojo.Disburse;

import cn.kgc.service.DisburseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * @author 李梦煊
 * @version 1.0
 * @date 2022/10/14 - 16:53
 */
@Service
public class DisburseServiceImpl implements DisburseService {
    @Autowired
    private DisburseMapper disburseMapper;

    @Override
    public List<Disburse> getAllDisbure(Integer currentPage,Integer limit,String clientName) {
        return disburseMapper.getAllDisbure(currentPage,limit,clientName);
    }

    @Override
    public int getTotalCount(String clientName) {
        //总行数
        int totalCount = disburseMapper.getTotalCount(clientName);
        //计算出总页数
        int totalPage = 0;
        if (totalCount % 2 == 0) {
            totalPage = totalCount;
        } else {
            //需要多加一页
            totalPage = totalCount;
        }
        return totalPage;
    }

    @Override
    public int addDisburse(Disburse disburse) {
        return disburseMapper.addDisburse(disburse);
    }

    @Override
    public List<Map<Integer,String>> count() {
        return disburseMapper.count();
    }

    @Override
    public List<Map<Integer, String>> column() {
        return disburseMapper.column();
    }

    @Override
    public int updateDisById(Disburse disburse) {
        return disburseMapper.updateDisById(disburse);
    }

    @Override
    public int delDisById(String paidId) {
        return disburseMapper.delDisById(paidId);
    }



}
